package com.pdwl.controller;

import com.pdwl.common.dtos.PageRequestDto;
import com.pdwl.common.dtos.PageResponseResult;
import com.pdwl.common.vo.OrderVo;
import com.pdwl.pojo.Order;
import com.pdwl.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 订单控制层
 * @Author: TLB
 * @Date: 2023/1/12 14:21
 */
@RestController
@RequestMapping("/api/order")
@Api(tags = "订单管理")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 根据条件分页查询
     * @param pageRequestDto
     * @return
     */
    @PostMapping("/page")
    @ApiOperation("根据条件分页查询")
    public PageResponseResult<List<OrderVo>> page(@RequestBody PageRequestDto<Order> pageRequestDto) {

        return orderService.pageByOrder(pageRequestDto);
    }
}
